var App = require("../../base/app");
var utils = require("../../utils/utils");
var common = require("./common");
var youShi = new App("有柿", {
  interval: 10,
});
var inTask = require("./inTask");
var aRead = require("./aRead");
var aEat1 = require("./aEat1");
var aEat2 = require("./aEat2");
var aEat3 = require("./aEat3");
var aEat4 = require("./aEat4");
var aWalk = require("./aWalk");
var aSleepGet = require("./aSleepGet");
var aSleep = require("./aSleep");
var aTreasure = require("./aTreasure");
youShi.as = [aEat1, aEat2, aEat3, aEat4, aSleepGet, aSleep, aWalk];
youShi.run = function () {
  aRead.flow();
  if (common.inHome()) {
    sleep(utils.getRandom(1.5, 2, 1000));
    common.toTask();
    sleep(utils.getRandom(5, 12, 1000));
    inTask.run();
    var nextAction = this.getNextAction();
    if (nextAction) {
      nextAction.flow();
    } else {
      aTreasure.flow();
    }
  }
};

module.exports = youShi;
